package cn.gok.hotelback.controller;
import cn.gok.hotelback.entity.OrderAppendReview;
import cn.gok.hotelback.service.OrderAppendReviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/order/appendReview")
public class OrderAppendReviewController {
    @Autowired
    private OrderAppendReviewService appendReviewService;
    @PostMapping("/add")
    public String addAppendReview(@RequestBody OrderAppendReview appendReview) {
        int result = appendReviewService.addAppendReview(appendReview);
        return result > 0 ? "success" : "fail";
    }
    @GetMapping("/list")
    public List<OrderAppendReview> getAppendsByOrderId(@RequestParam String orderId) {
        return appendReviewService.getAppendsByOrderId(orderId);
    }
    @PutMapping("/update")
    public String updateAppendReview(@RequestBody OrderAppendReview appendReview) {
        int result = appendReviewService.updateAppendReview(appendReview.getAppendId(), appendReview.getAppendText());
        return result > 0 ? "success" : "fail";
    }
    @PostMapping("/delete")
    public String deleteAppendReview(@RequestParam Integer appendId) {
        int result = appendReviewService.deleteByAppendId(appendId);
        return result > 0 ? "success" : "fail";
    }
} 